<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/2
 * Time: 13:25
 */

namespace app\home\model;

use think\Model;

use think\Db;


class User extends Model
{

    protected $table = 'users';

    public function login($data){
        $user=Db::name('users')->where('mobile','=',$data['mobile'])->find();
        if($user){
            if($user['password'] == mduser($data['password'])){

                return ['code'=>1,'msg'=>'登录成功','res'=>$user];//信息正确

            }else{
                return ['code'=>2,'msg'=>'密码有误','res'=>''];//密码错误

            }
        }else{
            return ['code'=>3,'msg'=>'用户不存在','res'=>''];//用户不存在

        }
    }






}